#ifndef PROCESS_SUPERVISION_H
#define PROCESS_SUPERVISION_H

#include "process_management.h"
#include "supervision_queue.h"
#include "message_passing.h"

/* Registers the process supervisor as a supervisor of supervised */
int32_t register_supervisor(PCB* supervisor, int32_t supervised_pid);

/* Unregisters the process supervisor by removing it from the supervised processes' PCB. Returns 1 in case of success, 0 otherwise */
int32_t unregister_supervisor(PCB* supervisor);

/* goes through all supervised's supervisors and unregisters it as one of their supervised process. Returns 1 in case of sucess, 0 otherwise */
int32_t unregister_supervised(PCB* supervised);

/* Signals the termination of the process terminated to its supervisors. The code parameter is the code returned by the supervised process when it has terminated using message passing. It also removes terminated from the supervision queue it was in.  */
int32_t signal_termination(PCB* terminated, int32_t code);


#endif

